processMessage{
  System.out.println(StringUtils.toHexString(msg.array()));
  if (isIdentifierMethodSelectionMessage(msg) && lastStep == null) {
    byte[] response=new byte[2];
 else   if (isConnectionRequest(msg) && lastStep == Step.METHOD_SELECTION) {
 else   if (isBindRequest(msg) && lastStep == Step.METHOD_SELECTION) {
    System.out.println("STEP 2: BIND");
}
setConnected{
    Socks5Reply reply=(Socks5Reply)this.response;
      reply.setREP(SOCKS.REP.GENERAL_SOCKS_SERVER_FAILURE);
}
hasResponse{ }
getResponse{
  return response.getBytes();
}
isReady{ }
getOutboundAddress{ }
processBind{ }
processConnection{
  int addressType=msg.getByte(3);
    Socks5Reply reply=new Socks5Reply();
    reply.setATYP(SOCKS.ATYP.IPV4);
    try {
      reply.setREP(SOCKS.REP.HOST_UNREACHABLE);
      reply.setREP(SOCKS.REP.GENERAL_SOCKS_SERVER_FAILURE);
    Socks5Reply reply=new Socks5Reply();
    reply.setATYP(SOCKS.ATYP.DOMAINNAME);
    try {
      reply.setREP(SOCKS.REP.SUCCEEDED);
      reply.setREP(SOCKS.REP.GENERAL_SOCKS_SERVER_FAILURE);
}
connectIPv4{
  msg.getBytes(4,this.ip);
  int port=(((0xFF & msg.getByte(8)) << 8) + (0xFF & msg.getByte(9)));
}
connectDomain{
  checkCapacity(msg,5);
  checkCapacity(msg,5 + cnt + 2);
  byte[] domain=new byte[cnt];
  address=new InetSocketAddress(new String(domain),port);
  this.ip=address.getAddress().getAddress();
}
connectIPv6{
  checkCapacity(msg,22);
  byte[] addr=new byte[16];
  msg.getBytes(4,addr);
  int port=(((0xFF & msg.getByte(20)) << 8) + (0xFF & msg.getByte(21)));
    address=new InetSocketAddress(InetAddress.getByAddress(addr),port);
}
isConnectionRequest{
  checkCapacity(msg,2);
}
isBindRequest{
  checkCapacity(msg,2);
}
checkCapacity{
  if (msg.capacity() < need) {
}
isIdentifierMethodSelectionMessage{
  if (msg.capacity() >= 3 && msg.capacity() < 257) {
    int cnt=msg.getByte(1);
      return true;
}
isBIND{
  return (lastStep == Step.BIND);
}
isCONNECT{
  return (lastStep == Step.CONNECT);
}
toString{ }
